<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:jsf="http://xmlns.jcp.org/jsf"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">
    <style>
        .max {
            width: 100% !important;
        }
        </style>
    
    <h:form>
        <p:commandButton value="REGRESAR AL LISTADO"
                         update=":panelContent">
            <f:setPropertyActionListener
                target="#{navigationController.navigationContent}"
                value="./pages/administration/employee_view.xhtml" />
        </p:commandButton>
    </h:form>
    <p:separator/>
    <h:form>
        <h1><h:outputText value="Create/Edit"/></h1>
        <p:panelGrid columns="2" style="width: 100%;">
           
            <p:outputLabel value="FirstName:" for="firstName" />
            <p:inputText id="firstName" value="#{employeeRoleController.employee.firstName}" title="FirstName" styleClass="max"/>
            <p:outputLabel value="LastName:" for="lastName" />
            <p:inputText id="lastName" value="#{employeeRoleController.employee.lastName}" title="LastName" styleClass="max"/>
            <p:outputLabel value="Dni:" for="dni" />
            <p:inputText id="dni" value="#{employeeRoleController.employee.dni}" title="Dni" styleClass="max"/>
            <p:outputLabel value="Phone:" for="phone" />
            <p:inputText id="phone" value="#{employeeRoleController.employee.phone}" title="Phone" styleClass="max"/>
            <p:outputLabel value="Address:" for="address" />
            <p:inputText id="address" value="#{employeeRoleController.employee.address}" title="Address" styleClass="max"/>
            <p:outputLabel value="UserName:" for="userName" />
            <p:inputText id="userName" value="#{employeeRoleController.employee.userName}" title="UserName" styleClass="max"/>
            <p:outputLabel value="PasswordName:" for="passwordName" />
            <p:inputText id="passwordName" value="#{employeeRoleController.employee.passwordName}" title="PasswordName" styleClass="max"/>
            <p:outputLabel value="Role:" for="role" />            
            <p:selectOneMenu id="role" value="#{employeeRoleController.employee.role}" >
                <f:selectItem itemLabel="NINGÚN ROL DE USUARIO" noSelectionOption="true"/>
                <f:selectItem itemLabel="ADMINISTRADOR" itemValue="ADMINISTRADOR"/>
                <f:selectItem itemLabel="ALMACENERO" itemValue="ALMACENERO"/>
                <f:selectItem itemLabel="VENDEDOR" itemValue="VENDEDOR"/>
            </p:selectOneMenu>
          
            <p:outputLabel value="ShopId:" for="shopId" />
            <p:selectOneMenu id="shopId" value="#{employeeRoleController.employee.shopId}" 
                             converter="entityConverter">
                <f:selectItem itemLabel="Seleccione una tienda" noSelectionOption="true" />
                <f:selectItems value="#{employeeRoleController.listShop}" var="shop"
                               itemLabel="#{shop.name}" itemValue="#{shop}"/>
            </p:selectOneMenu>
         
        </p:panelGrid>
        <br/>
        <p:commandButton value="GUARDAR DATOS"
                         action="#{employeeRoleController.saveOrUpdateEmployee()}"
                         update="@form" />
    </h:form>
    
</ui:composition>
